package com.weiaibenpao.demo.chislim.presenter;

import com.weiaibenpao.demo.chislim.base.BasePresenter;
import com.weiaibenpao.demo.chislim.bean.ChinaRankBean;
import com.weiaibenpao.demo.chislim.retrofit.RetrofitUtils;
import com.weiaibenpao.demo.chislim.retrofit.rx.LoadingTransformer;
import com.weiaibenpao.demo.chislim.retrofit.rx.NetWorkTransformer;
import com.weiaibenpao.demo.chislim.retrofit.rx.SimpleObserver;
import com.weiaibenpao.demo.chislim.view.RankView;

/**
 * Created by wlx on 2017/12/13.
 */

public class RankPresenter extends BasePresenter<RankView> {
//    @Query("userId") int userId,
//    @Query("page") int page,
//    @Query("pageSize") String pageSize,
//    @Query("code") String code
    public void getRank(int userId, int page,int pageSize,String code){
        RetrofitUtils.getAPIService().getRankList(userId,page,pageSize,code).
                compose(new NetWorkTransformer<ChinaRankBean>()).
                   compose(new LoadingTransformer<ChinaRankBean>(mContext)).
                subscribe(new SimpleObserver<ChinaRankBean>(mCompositeDisposable) {
                    @Override
                    public void call(ChinaRankBean chinaRankBean) {
                        getView().requestSuccess(chinaRankBean);
                    }
                });
    }
}
